#!/bin/sh
# $1 -- Type
# $2 -- process
# $3 -- Dir
# $4 -- file name
[ "$1" = "client" ] && {
	[ "$2" = "new" ] && {
		/etc/openvpn/create-client $3 $4
	}
	[ "$2" = "del" ] && {
		rm -f /www/openvpn/$3/clients/$4.key
		rm -f /www/openvpn/$3/clients/$4.crt
		rm -f /etc/openvpn/$3/$4.csr
	}
}
[ "$1" = "server" ] && {
	[ "$2" = "new" ] && {
		/etc/openvpn/create-server $3 $4
	}
	[ "$2" = "del" ] && {
		rm -f /www/openvpn/$3/$4.key
		rm -f /www/openvpn/$3/$4.crt
	}
}
[ "$1" = "ca" ] && {
	[ "$2" = "new" ] && {
		/etc/openvpn/create-ca $3
	}
	[ "$2" = "del" ] && {	
		rm -f /www/openvpn/$3/ca.crt
		rm -f /etc/openvpn/$3/ca.key
	}
}
